
package com.pingsky.apm.agent.core.trace;


import com.pingsky.apm.network.language.agent.v1.KeyStringValuePair;

public class TagValuePair {
    private String tag;
    private String value;

    public TagValuePair(String tag, String value) {
        this.tag = tag;
        this.value = value;
    }

    public String getTag() {
        return tag;
    }

    public String getValue() {
        return value;
    }

    public KeyStringValuePair build() {
        KeyStringValuePair.Builder keyValueBuilder = KeyStringValuePair.newBuilder();
        keyValueBuilder.setKey(tag);
        if (value != null) {
            keyValueBuilder.setValue(value);
        }
        return keyValueBuilder.build();
    }

    @Override
    public String toString() {
        return "TagValuePair{" +
                "tag='" + tag + '\'' +
                ", value='" + value + '\'' +
                '}';
    }
}